Fix memory leak in remote logging connection cache#56695
Merged
potiuk merged 1 commit intoapache:mainfrom Oct 16, 2025
Merged
Conversation
The remote logging connection cache was using `@lru_cache` with the API client instance as a parameter. This caused client references to be retained in the cache indefinitely, preventing garbage collection and causing memory leaks when tasks created multiple client instances. The new implementation ensures connection details are cached for performance while allowing client instances to be properly garbage collected after use.
potiuk
approved these changes
Oct 16, 2025
eladkal
approved these changes
Oct 16, 2025
Contributor
Backport failed to create: v3-1-test. View the failure log Run details
You can attempt to backport this manually by running: cherry_picker 416c73e v3-1-testThis should apply the commit to the v3-1-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continue |
Member
|
Looks like some earlier change needs to be cherry-picked first |
snreddygopu
pushed a commit
to Teradata/airflow
that referenced
this pull request
Oct 16, 2025
The remote logging connection cache was using `@lru_cache` with the API client instance as a parameter. This caused client references to be retained in the cache indefinitely, preventing garbage collection and causing memory leaks when tasks created multiple client instances. The new implementation ensures connection details are cached for performance while allowing client instances to be properly garbage collected after use.
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 17, 2025
The remote logging connection cache was using `@lru_cache` with the API client instance as a parameter. This caused client references to be retained in the cache indefinitely, preventing garbage collection and causing memory leaks when tasks created multiple client instances. The new implementation ensures connection details are cached for performance while allowing client instances to be properly garbage collected after use.
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 19, 2025
The remote logging connection cache was using `@lru_cache` with the API client instance as a parameter. This caused client references to be retained in the cache indefinitely, preventing garbage collection and causing memory leaks when tasks created multiple client instances. The new implementation ensures connection details are cached for performance while allowing client instances to be properly garbage collected after use.
kaxil
added a commit
that referenced
this pull request
Oct 21, 2025
The remote logging connection cache was using `@lru_cache` with the API client instance as a parameter. This caused client references to be retained in the cache indefinitely, preventing garbage collection and causing memory leaks when tasks created multiple client instances. The new implementation ensures connection details are cached for performance while allowing client instances to be properly garbage collected after use. (cherry picked from commit 416c73e)
TyrellHaywood
pushed a commit
to TyrellHaywood/airflow
that referenced
this pull request
Oct 22, 2025
The remote logging connection cache was using `@lru_cache` with the API client instance as a parameter. This caused client references to be retained in the cache indefinitely, preventing garbage collection and causing memory leaks when tasks created multiple client instances. The new implementation ensures connection details are cached for performance while allowing client instances to be properly garbage collected after use.
Closed
2 tasks
2 tasks
vatsrahul1001
added a commit
to astronomer/airflow
that referenced
this pull request
Nov 4, 2025
)" This reverts commit 416c73e.
potiuk
pushed a commit
that referenced
this pull request
Dec 1, 2025
RoyLee1224
pushed a commit
to RoyLee1224/airflow
that referenced
this pull request
Dec 3, 2025
* Revert "Fix memory leak in remote logging connection cache (apache#56695)" This reverts commit 416c73e. * enable e2e ui test to install pnpm if not installed
Copilot AI
pushed a commit
to jason810496/airflow
that referenced
this pull request
Dec 5, 2025
* Revert "Fix memory leak in remote logging connection cache (apache#56695)" This reverts commit 416c73e. * enable e2e ui test to install pnpm if not installed
itayweb
pushed a commit
to itayweb/airflow
that referenced
this pull request
Dec 6, 2025
* Revert "Fix memory leak in remote logging connection cache (apache#56695)" This reverts commit 416c73e. * enable e2e ui test to install pnpm if not installed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The remote logging connection cache was using
@lru_cachewith the API client instance as a parameter. This caused client references to be retained in the cache indefinitely, preventing garbage collection and causing memory leaks when tasks created multiple client instances.The new implementation ensures connection details are cached for performance while allowing client instances to be properly garbage collected after use.
In Airflow 3.0.6 various tasks running on Celery failed with OOMs as the memory leaks were significant. After applying changes in this PR, the memory stayed mostly-flat and there were 0 task failures.
Celery Worker with 4 GB memory on Airflow 3.0.6

Celery Worker with 4 GB memory with the changes in this PR**

Part of #56641
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.